home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
tools
/
ebsx130
/
menu2.c
< prev
next >
Wrap
Text File
|
1997-05-02
|
6KB
|
297 lines
/* EB.X V1.40d
1996.05.2 鈴木 健児 */
#include "common2.h"
#include <iocslib.h>
#include <jctype.h>
#include <method/Dialog_i.h>
#include <method/Event_i.h>
#include <method/Memory_i.h>
#include <method/Task_i.h>
#include <method/Dos_i.h>
#include <method/_methodSx.h>
/* */
int init_linktbl( void );
int find_linkdata( int );
int push_link_a( short , short );
int push_link_b( unsigned int );
int get_foward( void );
int get_next( void );
int get_up( void );
unsigned int conv_hex( unsigned int data );
int init_kaisoutbl( void );
int push_menukaisou( unsigned int );
int init_rirekitbl( void );
int push_rireki( int );
static int menuposmax; /* static ではない */
static unsigned int menukaisoutbl[ 34 ];
int menukaisoumax;
static unsigned int rirekitbl[ 258 ];
int rirekimax;
int nextflg;
int linkflg;
/* */
typedef struct linkinfo {
short l_type; /* タイプ グラフィック、メニュー、音声、参照 */
short textpos; /* テキスト内の位置(@のある場所) */
long linkpos; /* リンク先のファイル位置 */
} linkinfo;
linkinfo linktbl[ 512 ];
int linkMax;
/* 関数 */
int find_linkdata( int textpos )
{
int count;
int flg;
int offset;
flg = -1;
count = 0;
while( textpos >= linktbl[ count ].textpos )
{
/* ULError_int( linktbl[ count ].textpos );
*/
if( textpos == linktbl[ count ].textpos )
{
flg = count;
};
count++;
};
if( flg >= 0 )
{
switch( linktbl[ flg ].l_type )
{
case 1:
DispImage( linktbl[ flg ].linkpos );
break;
case 2:
nextpos = linktbl[ flg ].linkpos;
push_menukaisou( nextpos );
DOSSEEK( cdfile , nextpos , SEEK_SET );
init_rirekitbl();
init_linktbl();
offset = jis2shift( tex , 0x800*4 , 0 , &nextflg );
push_rireki( nextpos );
nextpos += offset;
DispMenu( );
break;
case 3:
DispLink( linktbl[ flg ].linkpos );
break;
case 4:
DispImageEP( linktbl[ flg ].linkpos );
break;
};
/* ShowMenu( menupostbl[ num-1 ] );
*/
};
return( 0 );
};
int get_foward( void )
{
int offset;
/* f */
if( rirekimax > 1 )
{
nextpos = rirekitbl[ rirekimax-1 ];
/* ULError_int( rirekitbl[ rirekimax-1] ); */
DOSSEEK( cdfile , nextpos , SEEK_SET );
rirekimax--;
init_linktbl();
offset = jis2shift( tex , 0x800*4 , 0 , &nextflg );
nextpos += offset;
}
return( 0 );
}
int get_next( void )
{
int offset;
/* n */
if( nextflg == 1 )
{
if(( rirekimax > 0 ) && ( rirekimax <= 256 ))
{
if( rirekitbl[ rirekimax+1 ] != 0 )
{
nextpos = rirekitbl[ rirekimax+1 ];
menukaisoutbl[ menukaisoumax ] = nextpos;
/* ULError_int( rirekitbl[ rirekimax+1] ); */
DOSSEEK( cdfile , rirekitbl[ rirekimax+1 ] , SEEK_SET );
rirekimax++;
init_linktbl();
offset = jis2shift( tex , 0x800*4 , 0 , &nextflg );
nextpos += offset;
/* ULError_int( nextpos ); */
} else {
/* ULError_int( nextpos ); */
DOSSEEK( cdfile , nextpos , SEEK_SET );
push_rireki( nextpos );
menukaisoutbl[ menukaisoumax ] = nextpos;
init_linktbl();
offset = jis2shift( tex , 0x800*4 , 0 , &nextflg );
nextpos += offset;
/* ULError_int( nextpos ); */
};
};
};
return( 0 );
}
int get_up( void )
{
int offset;
if( menukaisoumax >= 2 )
{
menukaisoumax-=2;
/* printf( "pr up = %d\n" , menukaisoumax ); */
nextpos = menukaisoutbl[ menukaisoumax+1 ];
push_menukaisou( nextpos );
/* printf( "prt = %d\n", menukaisoumax ); */
init_rirekitbl( );
init_linktbl( );
DOSSEEK( cdfile , nextpos , SEEK_SET );
offset = jis2shift( tex , 0x800*4 , 0 , &nextflg );
if( nextflg == 1 ) /* メニュー項目の場合は履歴に残さない(nextを禁止する) */
{
/* printf( "PUSH RIREKI\n" ); */
push_rireki( nextpos );
};
nextpos += offset;
};
return( 0 );
}
int init_linktbl( void )
{
linktbl[ 0 ].textpos = 0x7fff;
menuposmax = 0;
return( 0 );
}
int push_link_a( short l_type , short textpos )
{
if( menuposmax == 512 )
{
return( -1 );
};
/* ULError_int( textpos );
*/ linktbl[ menuposmax ].l_type = l_type;
linktbl[ menuposmax ].textpos = textpos;
/* ULError_int( linktbl[ menuposmax].textpos );
*/
return( 0 );
}
int push_link_b( unsigned int linkpos )
{
if( menuposmax == 512 )
{
return( -1 );
};
linktbl[ menuposmax ].linkpos = linkpos;
menuposmax++;
linktbl[ menuposmax ].textpos = 0x7fff; /* 大きい値 */
return( 0 );
}
int init_kaisoutbl( void )
{
menukaisoutbl[ 0 ] = 0;
menukaisoumax = 0;
return( 0 );
}
int push_menukaisou( unsigned int filepos )
{
if( menukaisoumax == 32 )
{
return( -1 );
};
menukaisoumax++;
menukaisoutbl[ menukaisoumax ] = filepos;
return( 0 );
}
int init_rirekitbl( void )
{
rirekitbl[ 0 ] = 0;
rirekimax = 0;
return( 0 );
}
int push_rireki( int rireki )
{
if( rirekimax == 256 )
{
return( -1 );
};
rirekimax++;
rirekitbl[ rirekimax ] = rireki;
rirekitbl[ rirekimax+1 ] = 0;
return( 0 );
}
/* BCDコードを16進に変換 */
unsigned int conv_hex( unsigned int data )
{
unsigned int data16;
unsigned char hhh,hhl,hlh,hll;
unsigned char lhh,lhl,llh,lll;
data16 = 0;
hhh = (data & 0xf0000000) >> 28;
hhl = (data & 0x0f000000) >> 24;
hlh = (data & 0x00f00000) >> 20;
hll = (data & 0x000f0000) >> 16;
lhh = (data & 0x0000f000) >> 12;
lhl = (data & 0x00000f00) >> 8;
llh = (data & 0x000000f0) >> 4;
lll = (data & 0x0000000f);
data16 = hhh*10000000 + hhl*1000000 + hlh*100000 + hll*10000;
data16 = data16 + lhh*1000 + lhl*100 + llh*10 + lll;
return( data16 );
}